home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / gplot3_2.lha / gnuplot / term / bigfig.trm < prev    next >
Text File  |  1992-03-25  |  4KB  |  128 lines

  1. /*
  2.  * $Id: bigfig.trm,v 3.26 92/03/24 22:35:50 woo Exp Locker: woo $
  3.  */
  4.  
  5. /* GNUPLOT - fig.trm */
  6. /*
  7.  * Copyright (C) 1990, 1991, 1992
  8.  *
  9.  * Permission to use, copy, and distribute this software and its
  10.  * documentation for any purpose with or without fee is hereby granted,
  11.  * provided that the above copyright notice appear in all copies and
  12.  * that both that copyright notice and this permission notice appear
  13.  * in supporting documentation.
  14.  *
  15.  * Permission to modify the software is granted, but not the right to
  16.  * distribute the modified code.  Modifications are to be distributed
  17.  * as patches to released version.
  18.  *
  19.  * This software  is provided "as is" without express or implied warranty.
  20.  *
  21.  * This file is included by ../term.c.
  22.  *
  23.  * This terminal driver supports:
  24.  *  Fig graphics language
  25.  *
  26.  * AUTHORS
  27.  *  Micah Beck, David Kotz
  28.  *
  29.  * send your comments or suggestions to (info-gnuplot@ames.arc.nasa.gov).
  30.  *
  31.  */
  32.  
  33. /*
  34.  * Original for Fig code output by Micah Beck, 1989
  35.  * Department of Computer Science, Cornell University
  36.  * Updated by David Kotz for gnuplot 2.0
  37.  * More efficient output by Ian Dall
  38.  * Increased size of plot by Ian Dall
  39.  */
  40.  
  41. #define BFIG_HTIC       (7*FIG_RES/80)
  42. #define BFIG_VTIC       (7*FIG_RES/80)
  43. #define BFIG_HCHAR      (9*FIG_RES/80)
  44. #define BFIG_FONT_S     (16)
  45. #define BFIG_VCHAR      ((BFIG_FONT_S)*FIG_RES/80)  /* height in pixels of font
  46.         */
  47.  
  48. #define BFIG_ARROW_WIDTH BFIG_HTIC
  49. #define BFIG_ARROW_HEIGHT BFIG_HTIC
  50.  
  51.  
  52.  
  53. /* 7 inches wide by 5 inches high */
  54. #define BFIG_XMAX (8 * FIG_RES)
  55. #define BFIG_YMAX (5 * FIG_RES)
  56.  
  57. #define BFIG_XOFF (FIG_RES/2)
  58. #define BFIG_YOFF (FIG_RES/2)
  59.  
  60.  
  61. BFIG_vector(ux,uy)
  62.      unsigned int ux,uy;
  63. {
  64.   int x=ux, y=uy;
  65.  
  66.   if (FIG_polyvec_stat != FIG_poly_part)
  67.     {
  68.       fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f  %d %d\n",
  69.               O_POLYLINE, T_POLYLINE,
  70.               FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
  71.               0, 0);
  72.       fprintf(outfile, "%d %d",
  73.               BFIG_XOFF + FIG_posx, BFIG_YMAX + BFIG_YOFF - FIG_posy);
  74.       FIG_poly_vec_cnt = 1;
  75.       FIG_polyvec_stat = FIG_poly_part;
  76.     }
  77.   fprintf(outfile, " %d %d",
  78.           BFIG_XOFF +  x, BFIG_YMAX + BFIG_YOFF-y);
  79.   FIG_poly_vec_cnt++;
  80.   if (FIG_poly_vec_cnt > 50)
  81.     FIG_poly_clean(FIG_polyvec_stat);
  82.  
  83.   FIG_posx = x;
  84.   FIG_posy = y;
  85. }
  86.  
  87.  
  88.  
  89.  
  90. BFIG_arrow(sx, sy, ex, ey, head)
  91.         int sx, sy;     /* start coord */
  92.         int ex, ey;     /* end coord */
  93.     BOOLEAN head;
  94. {
  95.     FIG_poly_clean(FIG_polyvec_stat);
  96.         fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f  %d %d\n",
  97.                 O_POLYLINE, T_POLYLINE,
  98.                 FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
  99.                 head ? 1 : 0, 0);
  100.         /* arrow line */
  101.     if ( head )
  102.         fprintf(outfile, "%d %d %.3f %.3f %.3f\n",
  103.                     0, 0, 1.0,
  104.             (double)BFIG_ARROW_WIDTH, (double)BFIG_ARROW_HEIGHT);
  105.         fprintf(outfile, "%d %d %d %d 9999 9999\n",
  106.                 BFIG_XOFF + sx, BFIG_YOFF + BFIG_YMAX - sy,
  107.         BFIG_XOFF + ex, BFIG_YOFF + BFIG_YMAX - ey);
  108.  
  109.         FIG_posx = ex;
  110.         FIG_posy = ey;
  111. }
  112.  
  113. BFIG_put_text(x, y, str)
  114.         int x, y;
  115.         char *str;
  116. {
  117.   if (strlen(str) == 0) return;
  118.   FIG_poly_clean(FIG_polyvec_stat);
  119.     y = y - BFIG_VCHAR/2;               /* assuming vertical center justified */
  120.  
  121.     fprintf(outfile, "%d %d %d %d %d %d %d %6.3f %d %d %d %d %d %s\01\n",
  122.                   O_TEXT, FIG_justify,
  123.                   FIG_ROMAN_FONT, BFIG_FONT_S, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_angle,
  124.                   1, BFIG_VCHAR, BFIG_HCHAR*strlen(str), BFIG_XOFF + x,
  125.         BFIG_YMAX + BFIG_YOFF-y, str);
  126. }
  127.  
  128.